import req from '@/utils/request'
const baseURL = process.env.VUE_APP_BASE_URL
export function getDeviceTree(data) {
    return req({
        method: 'get',
        url: process.env.VUE_APP_IOTBACK_URL + '/sl/deviceTree',
        params: data
    })
}
export function getAccounts(data) {
    return req({
        method: 'get',
        url: baseURL + '/superlink/api/devices/account/list',
        params: data
    })
}
export function getDevicesV2(data) {
    return req({
        method: 'get',
        url: baseURL + "/superlink/api/devices/v2/devices",
        params: data
    })
}
export function getFormulaInt(data) {
    return req({
        method: 'get',
        url: baseURL + "/superlink/api/production/formula/device/intersection",
        params: data
    })
}
export function postSplit(data, token) {
    return req({
        method: 'post',
        url: baseURL + `/superlink/api/production/formula/${token}/split`,
        data
    })
}
export function postAccount(data, token) {
    return req({
        method: 'post',
        url: baseURL + `/superlink/api/devices/account/update/${token}`,
        data
    })
}
export function getDeviceLists(params, token = '') {
    return req({
        method: 'get',
        url: baseURL + '/superlink/api/devices' + token,
        params
    })
}
export function createDevice(data) {
    return req({
        method: 'post',
        url: baseURL + '/superlink/api/devices/create',
        data
    })
}
export function createAssignments(data, userId) {
    return req({
        method: 'post',
        url: baseURL + "/superlink/api/assignments/create?userId=" + userId,
        data
    })
}
export function editDevice(data, token) {
    return req({
        method: 'put',
        url: baseURL + "/superlink/api/devices/update/" + token,
        data
    })
}
export function getInvocations(params, token) {
    return req({
        method: 'get',
        url: baseURL + '/superlink/api/commands/invocations',
        params
    })
}
export function delDevice(token) {
    return req({
        method: 'delete',
        url: baseURL + '/superlink/api/devices/delete/' + token,
    })
}
export function postInvocations(data, token) {
    return req({
        method: 'post',
        url: baseURL + '/superlink/api/devices/' + token + '/invocations',
        data
    })
}
export function devicesAssignments(data, token) {
    return req({
        method: 'get',
        url: baseURL + "/superlink/api/devices/" + token + "/assignments",
        data
    })
}
